import java.io.*;
import java.net.Socket;
import javax.swing.*;
public class Client_Socket {
    //静态方便其他类共享使用
    public static Socket socket;
    public static DataInputStream in;
    public static DataOutputStream out;
    public boolean success;    //是否连接服务器成功
    Client_Socket(){
        try {
            socket = new Socket("127.0.0.1",2000);
            in = new DataInputStream(socket.getInputStream());
            out = new DataOutputStream(socket.getOutputStream());
            success = true;
        }catch(IOException e) {
            JOptionPane.showMessageDialog(null, "服务器连接失败!");
            success = false;
        }
    }
}